package com.xci.core.setting;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author 吕艳阳
 */
@Data
@Component
@ConfigurationProperties(prefix = "xci.api")
public class ApiSetting {
    /**
     * 是否验证时间戳
     */
    private boolean validTimestamp = true;

    /**
     * 验证时间戳时验证偏差 单位秒
     */
    private int timestampOffset = 120;

    /**
     * 未授权消息
     */
    private String unAuthorizedMessage = "您没有此操作权限!";

    /**
     * 拦截地址
     */
    private String[] urlPatterns = new String[]{"/api/**"};

    /**
     * 忽略地址
     */
    private String[] excludes = new String[]{};

    /**
     * 请求body是否自动解密
     */
    private boolean requestBodyDecrypt = false;

    /**
     * 响应body是否自动加密
     */
    private boolean responseBodyEncrypt = false;

    /**
     * 是否解析IP地理位置
     */
    private boolean resolvingIpLocation = false;
}